<?php namespace Summer\Slideshow\Models;

use Model;

/**
 * Model
 */
class SlideshowModel extends Model
{
    use \Winter\Storm\Database\Traits\Validation;
    

    /**
     * @var string The database table used by the model.
     */
    public $table = 'summer_slideshow_slideshows';

    public $fillable = [
        'name',
        'slug'
    ];
    /**
     * @var array Validation rules
     */
    public $rules = [
        'name' => 'required|between:2,255',
        'slug' => 'required|between:2,255|unique:summer_slideshow_slideshows',
    ];
    public $hasMany = [
        'slides' => [
            'Summer\Slideshow\Models\SlideModel',
            'key' => 'slideshow_id',
            'otherKey' => 'id'
        ],
        'slides_count' => [
            'Summer\Slideshow\Models\SlideModel',
            'key' => 'slideshow_id',
            'otherKey' => 'id',
            'count' => true
        ]
    ];
}
